\(\int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx\) [55]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 103 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {a^2 (3 A+2 B) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {2 a^2 (3 A+2 B) \tan (c+d x)}{3 d}+\frac {a^2 (3 A+2 B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {B (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d} \]

[Out]

1/2*a^2*(3*A+2*B)*arctanh(sin(d*x+c))/d+2/3*a^2*(3*A+2*B)*tan(d*x+c)/d+1/6*a^2*(3*A+2*B)*sec(d*x+c)*tan(d*x+c)
/d+1/3*B*(a+a*sec(d*x+c))^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.19 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {4086, 3873, 3852, 8, 4131, 3855} \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {a^2 (3 A+2 B) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {2 a^2 (3 A+2 B) \tan (c+d x)}{3 d}+\frac {a^2 (3 A+2 B) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {B \tan (c+d x) (a \sec (c+d x)+a)^2}{3 d} \]

[In]

Int[Sec[c + d*x]*(a + a*Sec[c + d*x])^2*(A + B*Sec[c + d*x]),x]

[Out]

(a^2*(3*A + 2*B)*ArcTanh[Sin[c + d*x]])/(2*d) + (2*a^2*(3*A + 2*B)*Tan[c + d*x])/(3*d) + (a^2*(3*A + 2*B)*Sec[
c + d*x]*Tan[c + d*x])/(6*d) + (B*(a + a*Sec[c + d*x])^2*Tan[c + d*x])/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3873

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Dist[2*a*(b/d
), Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b
, d, e, f, n}, x]

Rule 4086

Int[csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_))
, x_Symbol] :> Simp[(-B)*Cot[e + f*x]*((a + b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[(a*B*m + A*b*(m + 1))/(b
*(m + 1)), Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^m, x], x] /; FreeQ[{a, b, A, B, e, f, m}, x] && NeQ[A*b - a*B
, 0] && EqQ[a^2 - b^2, 0] && NeQ[a*B*m + A*b*(m + 1), 0] &&  !LtQ[m, -2^(-1)]

Rule 4131

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(-C)*Cot
[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x
] /; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {B (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} (3 A+2 B) \int \sec (c+d x) (a+a \sec (c+d x))^2 \, dx \\ & = \frac {B (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} (3 A+2 B) \int \sec (c+d x) \left (a^2+a^2 \sec ^2(c+d x)\right ) \, dx+\frac {1}{3} \left (2 a^2 (3 A+2 B)\right ) \int \sec ^2(c+d x) \, dx \\ & = \frac {a^2 (3 A+2 B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {B (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{2} \left (a^2 (3 A+2 B)\right ) \int \sec (c+d x) \, dx-\frac {\left (2 a^2 (3 A+2 B)\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d} \\ & = \frac {a^2 (3 A+2 B) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {2 a^2 (3 A+2 B) \tan (c+d x)}{3 d}+\frac {a^2 (3 A+2 B) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {B (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.69 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.61 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {a^2 \left ((9 A+6 B) \text {arctanh}(\sin (c+d x))+\tan (c+d x) \left (12 (A+B)+3 (A+2 B) \sec (c+d x)+2 B \tan ^2(c+d x)\right )\right )}{6 d} \]

[In]

Integrate[Sec[c + d*x]*(a + a*Sec[c + d*x])^2*(A + B*Sec[c + d*x]),x]

[Out]

(a^2*((9*A + 6*B)*ArcTanh[Sin[c + d*x]] + Tan[c + d*x]*(12*(A + B) + 3*(A + 2*B)*Sec[c + d*x] + 2*B*Tan[c + d*
x]^2)))/(6*d)

Maple [A] (verified)

Time = 3.50 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.17

method result size
parts \(\frac {\left (A \,a^{2}+2 B \,a^{2}\right ) \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (2 A \,a^{2}+B \,a^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {A \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right ) a^{2}}{d}-\frac {B \,a^{2} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(120\)
derivativedivides \(\frac {A \,a^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,a^{2} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )+2 A \,a^{2} \tan \left (d x +c \right )+2 B \,a^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \,a^{2} \tan \left (d x +c \right )}{d}\) \(145\)
default \(\frac {A \,a^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,a^{2} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )+2 A \,a^{2} \tan \left (d x +c \right )+2 B \,a^{2} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \,a^{2} \tan \left (d x +c \right )}{d}\) \(145\)
parallelrisch \(\frac {\left (-\frac {9 \left (A +\frac {2 B}{3}\right ) \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2}+\frac {9 \left (A +\frac {2 B}{3}\right ) \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2}+\left (A +2 B \right ) \sin \left (2 d x +2 c \right )+\left (2 A +\frac {5 B}{3}\right ) \sin \left (3 d x +3 c \right )+2 \sin \left (d x +c \right ) \left (A +\frac {3 B}{2}\right )\right ) a^{2}}{d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) \(148\)
norman \(\frac {\frac {8 a^{2} \left (3 A +2 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 d}-\frac {a^{2} \left (3 A +2 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {a^{2} \left (5 A +6 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}}{\left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}-\frac {a^{2} \left (3 A +2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {a^{2} \left (3 A +2 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(149\)
risch \(-\frac {i a^{2} \left (3 A \,{\mathrm e}^{5 i \left (d x +c \right )}+6 B \,{\mathrm e}^{5 i \left (d x +c \right )}-12 A \,{\mathrm e}^{4 i \left (d x +c \right )}-6 B \,{\mathrm e}^{4 i \left (d x +c \right )}-24 A \,{\mathrm e}^{2 i \left (d x +c \right )}-24 B \,{\mathrm e}^{2 i \left (d x +c \right )}-3 \,{\mathrm e}^{i \left (d x +c \right )} A -6 B \,{\mathrm e}^{i \left (d x +c \right )}-12 A -10 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{2 d}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{2 d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}\) \(214\)

[In]

int(sec(d*x+c)*(a+a*sec(d*x+c))^2*(A+B*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

(A*a^2+2*B*a^2)/d*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan(d*x+c)))+(2*A*a^2+B*a^2)/d*tan(d*x+c)+1/d*A
*ln(sec(d*x+c)+tan(d*x+c))*a^2-B*a^2/d*(-2/3-1/3*sec(d*x+c)^2)*tan(d*x+c)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.21 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {3 \, {\left (3 \, A + 2 \, B\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (3 \, A + 2 \, B\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, {\left (6 \, A + 5 \, B\right )} a^{2} \cos \left (d x + c\right )^{2} + 3 \, {\left (A + 2 \, B\right )} a^{2} \cos \left (d x + c\right ) + 2 \, B a^{2}\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \]

[In]

integrate(sec(d*x+c)*(a+a*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(3*(3*A + 2*B)*a^2*cos(d*x + c)^3*log(sin(d*x + c) + 1) - 3*(3*A + 2*B)*a^2*cos(d*x + c)^3*log(-sin(d*x +
 c) + 1) + 2*(2*(6*A + 5*B)*a^2*cos(d*x + c)^2 + 3*(A + 2*B)*a^2*cos(d*x + c) + 2*B*a^2)*sin(d*x + c))/(d*cos(
d*x + c)^3)

Sympy [F]

\[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=a^{2} \left (\int A \sec {\left (c + d x \right )}\, dx + \int 2 A \sec ^{2}{\left (c + d x \right )}\, dx + \int A \sec ^{3}{\left (c + d x \right )}\, dx + \int B \sec ^{2}{\left (c + d x \right )}\, dx + \int 2 B \sec ^{3}{\left (c + d x \right )}\, dx + \int B \sec ^{4}{\left (c + d x \right )}\, dx\right ) \]

[In]

integrate(sec(d*x+c)*(a+a*sec(d*x+c))**2*(A+B*sec(d*x+c)),x)

[Out]

a**2*(Integral(A*sec(c + d*x), x) + Integral(2*A*sec(c + d*x)**2, x) + Integral(A*sec(c + d*x)**3, x) + Integr
al(B*sec(c + d*x)**2, x) + Integral(2*B*sec(c + d*x)**3, x) + Integral(B*sec(c + d*x)**4, x))

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 167, normalized size of antiderivative = 1.62 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B a^{2} - 3 \, A a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 6 \, B a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 24 \, A a^{2} \tan \left (d x + c\right ) + 12 \, B a^{2} \tan \left (d x + c\right )}{12 \, d} \]

[In]

integrate(sec(d*x+c)*(a+a*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="maxima")

[Out]

1/12*(4*(tan(d*x + c)^3 + 3*tan(d*x + c))*B*a^2 - 3*A*a^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x +
 c) + 1) + log(sin(d*x + c) - 1)) - 6*B*a^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log
(sin(d*x + c) - 1)) + 12*A*a^2*log(sec(d*x + c) + tan(d*x + c)) + 24*A*a^2*tan(d*x + c) + 12*B*a^2*tan(d*x + c
))/d

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.73 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {3 \, {\left (3 \, A a^{2} + 2 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (3 \, A a^{2} + 2 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (9 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 24 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 16 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]

[In]

integrate(sec(d*x+c)*(a+a*sec(d*x+c))^2*(A+B*sec(d*x+c)),x, algorithm="giac")

[Out]

1/6*(3*(3*A*a^2 + 2*B*a^2)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(3*A*a^2 + 2*B*a^2)*log(abs(tan(1/2*d*x + 1/
2*c) - 1)) - 2*(9*A*a^2*tan(1/2*d*x + 1/2*c)^5 + 6*B*a^2*tan(1/2*d*x + 1/2*c)^5 - 24*A*a^2*tan(1/2*d*x + 1/2*c
)^3 - 16*B*a^2*tan(1/2*d*x + 1/2*c)^3 + 15*A*a^2*tan(1/2*d*x + 1/2*c) + 18*B*a^2*tan(1/2*d*x + 1/2*c))/(tan(1/
2*d*x + 1/2*c)^2 - 1)^3)/d

Mupad [B] (verification not implemented)

Time = 15.49 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.41 \[ \int \sec (c+d x) (a+a \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx=\frac {2\,a^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (\frac {3\,A}{2}+B\right )}{d}-\frac {\left (3\,A\,a^2+2\,B\,a^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-8\,A\,a^2-\frac {16\,B\,a^2}{3}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (5\,A\,a^2+6\,B\,a^2\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]

[In]

int(((A + B/cos(c + d*x))*(a + a/cos(c + d*x))^2)/cos(c + d*x),x)

[Out]

(2*a^2*atanh(tan(c/2 + (d*x)/2))*((3*A)/2 + B))/d - (tan(c/2 + (d*x)/2)*(5*A*a^2 + 6*B*a^2) + tan(c/2 + (d*x)/
2)^5*(3*A*a^2 + 2*B*a^2) - tan(c/2 + (d*x)/2)^3*(8*A*a^2 + (16*B*a^2)/3))/(d*(3*tan(c/2 + (d*x)/2)^2 - 3*tan(c
/2 + (d*x)/2)^4 + tan(c/2 + (d*x)/2)^6 - 1))